using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using BaseAmd.Mmt;

namespace SiemensAmd.Mmt
{
	public class BodyBuild
	{
		public static string GetEmptyPlaces(string nodeId, string containerId)
		{
			if (string.IsNullOrWhiteSpace(nodeId) || string.IsNullOrWhiteSpace(containerId))
			{
				throw new ArgumentNullException();
			}
			DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(82, 2);
			defaultInterpolatedStringHandler.AppendLiteral("<Action ID=\"107\" Places=\"Empty\">\r\n  <MagList NodeId=\"");
			defaultInterpolatedStringHandler.AppendFormatted(nodeId);
			defaultInterpolatedStringHandler.AppendLiteral("\" ContainerId=\"");
			defaultInterpolatedStringHandler.AppendFormatted(containerId);
			defaultInterpolatedStringHandler.AppendLiteral("\"/>\r\n</Action>");
			return defaultInterpolatedStringHandler.ToStringAndClear();
		}

		public static string GetToolsPlaces(string nodeId, string containerId)
		{
			if (string.IsNullOrWhiteSpace(nodeId) || string.IsNullOrWhiteSpace(containerId))
			{
				throw new ArgumentNullException();
			}
			DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(86, 2);
			defaultInterpolatedStringHandler.AppendLiteral("<Action ID=\"107\" Places=\"ToolsOnly\">\r\n  <MagList NodeId=\"");
			defaultInterpolatedStringHandler.AppendFormatted(nodeId);
			defaultInterpolatedStringHandler.AppendLiteral("\" ContainerId=\"");
			defaultInterpolatedStringHandler.AppendFormatted(containerId);
			defaultInterpolatedStringHandler.AppendLiteral("\"/>\r\n</Action>");
			return defaultInterpolatedStringHandler.ToStringAndClear();
		}

		public static string QueryByIdentify(string nodeId, string duploNo, string toolIdentify)
		{
			if (string.IsNullOrWhiteSpace(nodeId))
			{
				throw new ArgumentNullException();
			}
			DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(315, 3);
			defaultInterpolatedStringHandler.AppendLiteral("  <Action ID=\"115\">\r\n                < ToolData NodeId = \"");
			defaultInterpolatedStringHandler.AppendFormatted(nodeId);
			defaultInterpolatedStringHandler.AppendLiteral("\" >\r\n                < DataElem >\r\n                < TC_TP >\r\n                < TC_TP1 >");
			defaultInterpolatedStringHandler.AppendFormatted(duploNo);
			defaultInterpolatedStringHandler.AppendLiteral("</ TC_TP1 >\r\n                < TC_TP2 >");
			defaultInterpolatedStringHandler.AppendFormatted(toolIdentify);
			defaultInterpolatedStringHandler.AppendLiteral("</ TC_TP2 >\r\n                </ TC_TP >\r\n                </ DataElem >\r\n                </ ToolData >\r\n                </ Action >");
			return defaultInterpolatedStringHandler.ToStringAndClear();
		}

		public static string QueryByExternId(string nodeId, string externId)
		{
			if (string.IsNullOrWhiteSpace(nodeId))
			{
				throw new ArgumentNullException();
			}
			DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(142, 2);
			defaultInterpolatedStringHandler.AppendLiteral("<Action ID=\"116\">\r\n\t<ToolData NodeId=\"");
			defaultInterpolatedStringHandler.AppendFormatted(nodeId);
			defaultInterpolatedStringHandler.AppendLiteral("\">\r\n\t\t<DataElem>\r\n\t\t\t<TC_TP>\r\n\t\t\t\t<EXT_ID>");
			defaultInterpolatedStringHandler.AppendFormatted(externId);
			defaultInterpolatedStringHandler.AppendLiteral("</EXT_ID>\r\n\t\t\t</TC_TP>\r\n\t\t</DataElem>\r\n\t</ToolData>\r\n</Action>");
			return defaultInterpolatedStringHandler.ToStringAndClear();
		}

		public static string GetAllPlaces(string nodeId, string containerId)
		{
			if (string.IsNullOrWhiteSpace(nodeId) || string.IsNullOrWhiteSpace(containerId))
			{
				throw new ArgumentNullException();
			}
			DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(80, 2);
			defaultInterpolatedStringHandler.AppendLiteral("<Action ID=\"107\" Places=\"All\">\r\n  <MagList NodeId=\"");
			defaultInterpolatedStringHandler.AppendFormatted(nodeId);
			defaultInterpolatedStringHandler.AppendLiteral("\" ContainerId=\"");
			defaultInterpolatedStringHandler.AppendFormatted(containerId);
			defaultInterpolatedStringHandler.AppendLiteral("\"/>\r\n</Action>");
			return defaultInterpolatedStringHandler.ToStringAndClear();
		}

		public static string GetAllPlacesMuti(List<MagListEntity> list, string cmdInfo = "108", string limit = "Empty")
		{
			DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(24, 2);
			defaultInterpolatedStringHandler.AppendLiteral("<Action ID=\"");
			defaultInterpolatedStringHandler.AppendFormatted(cmdInfo);
			defaultInterpolatedStringHandler.AppendLiteral("\" Places=\"");
			defaultInterpolatedStringHandler.AppendFormatted(limit);
			defaultInterpolatedStringHandler.AppendLiteral("\">");
			StringBuilder stringBuilder = new StringBuilder(defaultInterpolatedStringHandler.ToStringAndClear());
			foreach (MagListEntity item in list)
			{
				defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(35, 3);
				defaultInterpolatedStringHandler.AppendFormatted(Environment.NewLine);
				defaultInterpolatedStringHandler.AppendLiteral("<MagList NodeId=\"");
				defaultInterpolatedStringHandler.AppendFormatted(item.NodeId);
				defaultInterpolatedStringHandler.AppendLiteral("\" ContainerId=\"");
				defaultInterpolatedStringHandler.AppendFormatted(item.ContainerId);
				defaultInterpolatedStringHandler.AppendLiteral("\"/>");
				string value = defaultInterpolatedStringHandler.ToStringAndClear();
				stringBuilder.Append(value);
			}
			StringBuilder stringBuilder2 = stringBuilder;
			StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(9, 1, stringBuilder2);
			handler.AppendFormatted(Environment.NewLine);
			handler.AppendLiteral("</Action>");
			stringBuilder2.Append(ref handler);
			return stringBuilder.ToString();
		}

		public static string GetMmtConfig()
		{
			return "<Action ID=\"101\"/>";
		}

		public static string DeleteTrashTools(string nodeId, string containerId, List<int> locBuffer)
		{
			if (string.IsNullOrWhiteSpace(nodeId) || string.IsNullOrWhiteSpace(containerId) || locBuffer == null)
			{
				throw new ArgumentNullException();
			}
			if (locBuffer.Count == 0)
			{
				return "";
			}
			StringBuilder stringBuilder = new StringBuilder("<Action ID=\"119\">" + Environment.NewLine);
			foreach (int item in locBuffer)
			{
				StringBuilder stringBuilder2 = stringBuilder;
				StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(86, 4, stringBuilder2);
				handler.AppendLiteral("<ActionDeleteTool>\r\n    <Place nodeId=\"");
				handler.AppendFormatted(nodeId);
				handler.AppendLiteral("\" containerId=\"");
				handler.AppendFormatted(containerId);
				handler.AppendLiteral("\" no=\"");
				handler.AppendFormatted(item);
				handler.AppendLiteral("\"/>\r\n  </ActionDeleteTool>");
				handler.AppendFormatted(Environment.NewLine);
				stringBuilder2.Append(ref handler);
			}
			stringBuilder.Append("</Action>");
			return stringBuilder.ToString();
		}

		public static string MoveTools(string srcNodeId, string srcMag, int srcLoc, string dstNodeId, string dstMag, string toolIdentify, int dstLoc, int duploNo = 1)
		{
			if (string.IsNullOrWhiteSpace(srcNodeId) || string.IsNullOrWhiteSpace(srcMag) || string.IsNullOrWhiteSpace(dstNodeId) || string.IsNullOrWhiteSpace(dstMag) || string.IsNullOrWhiteSpace(toolIdentify))
			{
				throw new ArgumentNullException();
			}
			if (duploNo < 0)
			{
				throw new Exception("目标参数超限duploNo<0");
			}
			DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(211, 8);
			defaultInterpolatedStringHandler.AppendLiteral("<Action ID=\"162\">\r\n  <Transfer SrcNodeId=\"");
			defaultInterpolatedStringHandler.AppendFormatted(srcNodeId);
			defaultInterpolatedStringHandler.AppendLiteral("\" SrcMag=\"");
			defaultInterpolatedStringHandler.AppendFormatted(srcMag);
			defaultInterpolatedStringHandler.AppendLiteral("\" SrcLoc=\"");
			defaultInterpolatedStringHandler.AppendFormatted(srcLoc);
			defaultInterpolatedStringHandler.AppendLiteral("\" SrcLoadingPoint=\"0\"\r\n  DstNodeId=\"");
			defaultInterpolatedStringHandler.AppendFormatted(dstNodeId);
			defaultInterpolatedStringHandler.AppendLiteral("\" DstMag=\"");
			defaultInterpolatedStringHandler.AppendFormatted(dstMag);
			defaultInterpolatedStringHandler.AppendLiteral("\" DstLoc=\"");
			defaultInterpolatedStringHandler.AppendFormatted(dstLoc);
			defaultInterpolatedStringHandler.AppendLiteral("\" TC_TP2=\"");
			defaultInterpolatedStringHandler.AppendFormatted(toolIdentify);
			defaultInterpolatedStringHandler.AppendLiteral("\" TC_TP1=\"");
			defaultInterpolatedStringHandler.AppendFormatted(duploNo);
			defaultInterpolatedStringHandler.AppendLiteral("\"\r\n  DstLoadingPoint=\"0\" timeout=\"5000\">\r\n    1\r\n  </Transfer>\r\n</Action>");
			return defaultInterpolatedStringHandler.ToStringAndClear();
		}

		public static string ImportTools(string nodeId, string containerId, MmtToolEntity entity)
		{
			if (string.IsNullOrWhiteSpace(nodeId) || string.IsNullOrWhiteSpace(containerId) || entity == null)
			{
				throw new ArgumentNullException();
			}
			StringBuilder stringBuilder = new StringBuilder();
			StringBuilder stringBuilder2 = new StringBuilder();
			StringBuilder stringBuilder3 = new StringBuilder();
			StringBuilder stringBuilder4 = new StringBuilder();
			StringBuilder stringBuilder5 = new StringBuilder();
			StringBuilder stringBuilder6 = new StringBuilder();
			StringBuilder stringBuilder7 = new StringBuilder();
			StringBuilder stringBuilder8 = new StringBuilder();
			StringBuilder stringBuilder9 = new StringBuilder();
			StringBuilder stringBuilder10 = new StringBuilder();
			StringBuilder stringBuilder11 = stringBuilder;
			StringBuilder stringBuilder12 = stringBuilder11;
			StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(72, 3, stringBuilder11);
			handler.AppendLiteral("<Action ID=\"117\">\r\n  <ToolList NodeId=\"");
			handler.AppendFormatted(nodeId);
			handler.AppendLiteral("\" ContainerId=\"");
			handler.AppendFormatted(containerId);
			handler.AppendLiteral("\">\r\n    <DataElem>");
			handler.AppendFormatted(Environment.NewLine);
			stringBuilder12.Append(ref handler);
			Type typeFromHandle = typeof(MmtToolEntity);
			PropertyInfo[] properties = typeFromHandle.GetProperties();
			PropertyInfo[] array = properties;
			foreach (PropertyInfo propertyInfo in array)
			{
				MmtDataElemAttribute mmtDataElemAttribute = Attribute.GetCustomAttribute(propertyInfo, typeof(MmtDataElemAttribute)) as MmtDataElemAttribute;
				if (mmtDataElemAttribute == null || mmtDataElemAttribute.Ignore || mmtDataElemAttribute.IsOnlyIgnoreInsert)
				{
					continue;
				}
				object value = propertyInfo.GetValue(entity);
				if (value != null)
				{
					switch (mmtDataElemAttribute.NodeType)
					{
					case MmtNodeType.TcTp:
					{
						stringBuilder11 = stringBuilder2;
						StringBuilder stringBuilder20 = stringBuilder11;
						handler = new StringBuilder.AppendInterpolatedStringHandler(12, 4, stringBuilder11);
						handler.AppendLiteral("       <");
						handler.AppendFormatted(mmtDataElemAttribute.Adr);
						handler.AppendLiteral(">");
						handler.AppendFormatted<object>(value);
						handler.AppendLiteral("</");
						handler.AppendFormatted(mmtDataElemAttribute.Adr);
						handler.AppendLiteral(">");
						handler.AppendFormatted(Environment.NewLine);
						stringBuilder20.Append(ref handler);
						break;
					}
					case MmtNodeType.TcDpc:
					{
						stringBuilder11 = stringBuilder7;
						StringBuilder stringBuilder19 = stringBuilder11;
						handler = new StringBuilder.AppendInterpolatedStringHandler(12, 4, stringBuilder11);
						handler.AppendLiteral("       <");
						handler.AppendFormatted(mmtDataElemAttribute.Adr);
						handler.AppendLiteral(">");
						handler.AppendFormatted<object>(value);
						handler.AppendLiteral("</");
						handler.AppendFormatted(mmtDataElemAttribute.Adr);
						handler.AppendLiteral(">");
						handler.AppendFormatted(Environment.NewLine);
						stringBuilder19.Append(ref handler);
						break;
					}
					case MmtNodeType.TcMop:
					{
						stringBuilder11 = stringBuilder6;
						StringBuilder stringBuilder18 = stringBuilder11;
						handler = new StringBuilder.AppendInterpolatedStringHandler(12, 4, stringBuilder11);
						handler.AppendLiteral("       <");
						handler.AppendFormatted(mmtDataElemAttribute.Adr);
						handler.AppendLiteral(">");
						handler.AppendFormatted<object>(value);
						handler.AppendLiteral("</");
						handler.AppendFormatted(mmtDataElemAttribute.Adr);
						handler.AppendLiteral(">");
						handler.AppendFormatted(Environment.NewLine);
						stringBuilder18.Append(ref handler);
						break;
					}
					case MmtNodeType.TcMopc:
					{
						stringBuilder11 = stringBuilder8;
						StringBuilder stringBuilder17 = stringBuilder11;
						handler = new StringBuilder.AppendInterpolatedStringHandler(12, 4, stringBuilder11);
						handler.AppendLiteral("       <");
						handler.AppendFormatted(mmtDataElemAttribute.Adr);
						handler.AppendLiteral(">");
						handler.AppendFormatted<object>(value);
						handler.AppendLiteral("</");
						handler.AppendFormatted(mmtDataElemAttribute.Adr);
						handler.AppendLiteral(">");
						handler.AppendFormatted(Environment.NewLine);
						stringBuilder17.Append(ref handler);
						break;
					}
					case MmtNodeType.TcDp:
					{
						stringBuilder11 = stringBuilder5;
						StringBuilder stringBuilder16 = stringBuilder11;
						handler = new StringBuilder.AppendInterpolatedStringHandler(12, 4, stringBuilder11);
						handler.AppendLiteral("       <");
						handler.AppendFormatted(mmtDataElemAttribute.Adr);
						handler.AppendLiteral(">");
						handler.AppendFormatted<object>(value);
						handler.AppendLiteral("</");
						handler.AppendFormatted(mmtDataElemAttribute.Adr);
						handler.AppendLiteral(">");
						handler.AppendFormatted(Environment.NewLine);
						stringBuilder16.Append(ref handler);
						break;
					}
					case MmtNodeType.TcTpc:
					{
						stringBuilder11 = stringBuilder4;
						StringBuilder stringBuilder15 = stringBuilder11;
						handler = new StringBuilder.AppendInterpolatedStringHandler(12, 4, stringBuilder11);
						handler.AppendLiteral("       <");
						handler.AppendFormatted(mmtDataElemAttribute.Adr);
						handler.AppendLiteral(">");
						handler.AppendFormatted<object>(value);
						handler.AppendLiteral("</");
						handler.AppendFormatted(mmtDataElemAttribute.Adr);
						handler.AppendLiteral(">");
						handler.AppendFormatted(Environment.NewLine);
						stringBuilder15.Append(ref handler);
						break;
					}
					case MmtNodeType.TcTpg:
					{
						stringBuilder11 = stringBuilder3;
						StringBuilder stringBuilder14 = stringBuilder11;
						handler = new StringBuilder.AppendInterpolatedStringHandler(12, 4, stringBuilder11);
						handler.AppendLiteral("       <");
						handler.AppendFormatted(mmtDataElemAttribute.Adr);
						handler.AppendLiteral(">");
						handler.AppendFormatted<object>(value);
						handler.AppendLiteral("</");
						handler.AppendFormatted(mmtDataElemAttribute.Adr);
						handler.AppendLiteral(">");
						handler.AppendFormatted(Environment.NewLine);
						stringBuilder14.Append(ref handler);
						break;
					}
					case MmtNodeType.Tdi:
					{
						stringBuilder11 = stringBuilder10;
						StringBuilder stringBuilder13 = stringBuilder11;
						handler = new StringBuilder.AppendInterpolatedStringHandler(12, 4, stringBuilder11);
						handler.AppendLiteral("       <");
						handler.AppendFormatted(mmtDataElemAttribute.Adr);
						handler.AppendLiteral(">");
						handler.AppendFormatted<object>(value);
						handler.AppendLiteral("</");
						handler.AppendFormatted(mmtDataElemAttribute.Adr);
						handler.AppendLiteral(">");
						handler.AppendFormatted(Environment.NewLine);
						stringBuilder13.Append(ref handler);
						break;
					}
					}
				}
			}
			if (stringBuilder2.Length > 0)
			{
				stringBuilder2.Insert(0, "      <TC_TP>" + Environment.NewLine);
				stringBuilder11 = stringBuilder2;
				StringBuilder stringBuilder21 = stringBuilder11;
				handler = new StringBuilder.AppendInterpolatedStringHandler(14, 1, stringBuilder11);
				handler.AppendLiteral("      </TC_TP>");
				handler.AppendFormatted(Environment.NewLine);
				stringBuilder.Append(stringBuilder21.Append(ref handler));
			}
			if (stringBuilder3.Length > 0)
			{
				stringBuilder3.Insert(0, "      <TC_TPG>" + Environment.NewLine);
				stringBuilder11 = stringBuilder3;
				StringBuilder stringBuilder22 = stringBuilder11;
				handler = new StringBuilder.AppendInterpolatedStringHandler(15, 1, stringBuilder11);
				handler.AppendLiteral("      </TC_TPG>");
				handler.AppendFormatted(Environment.NewLine);
				stringBuilder.Append(stringBuilder22.Append(ref handler));
			}
			if (stringBuilder4.Length > 0)
			{
				stringBuilder4.Insert(0, "      <TC_TPC>" + Environment.NewLine);
				stringBuilder11 = stringBuilder4;
				StringBuilder stringBuilder23 = stringBuilder11;
				handler = new StringBuilder.AppendInterpolatedStringHandler(15, 1, stringBuilder11);
				handler.AppendLiteral("      </TC_TPC>");
				handler.AppendFormatted(Environment.NewLine);
				stringBuilder.Append(stringBuilder23.Append(ref handler));
			}
			if (stringBuilder5.Length > 0)
			{
				stringBuilder11 = stringBuilder;
				StringBuilder stringBuilder24 = stringBuilder11;
				handler = new StringBuilder.AppendInterpolatedStringHandler(26, 1, stringBuilder11);
				handler.AppendLiteral("      <DataElem Index=\"1\">");
				handler.AppendFormatted(Environment.NewLine);
				stringBuilder24.Append(ref handler);
				stringBuilder5.Insert(0, "      <TC_DP>" + Environment.NewLine);
				stringBuilder11 = stringBuilder5;
				StringBuilder stringBuilder25 = stringBuilder11;
				handler = new StringBuilder.AppendInterpolatedStringHandler(14, 1, stringBuilder11);
				handler.AppendLiteral("      </TC_DP>");
				handler.AppendFormatted(Environment.NewLine);
				stringBuilder.Append(stringBuilder25.Append(ref handler));
			}
			if (stringBuilder6.Length > 0)
			{
				stringBuilder6.Insert(0, "      <TC_MOP>" + Environment.NewLine);
				stringBuilder11 = stringBuilder6;
				StringBuilder stringBuilder26 = stringBuilder11;
				handler = new StringBuilder.AppendInterpolatedStringHandler(15, 1, stringBuilder11);
				handler.AppendLiteral("      </TC_MOP>");
				handler.AppendFormatted(Environment.NewLine);
				stringBuilder.Append(stringBuilder26.Append(ref handler));
			}
			if (stringBuilder7.Length > 0)
			{
				stringBuilder7.Insert(0, "      <TC_DPC>" + Environment.NewLine);
				stringBuilder11 = stringBuilder7;
				StringBuilder stringBuilder27 = stringBuilder11;
				handler = new StringBuilder.AppendInterpolatedStringHandler(15, 1, stringBuilder11);
				handler.AppendLiteral("      </TC_DPC>");
				handler.AppendFormatted(Environment.NewLine);
				stringBuilder.Append(stringBuilder27.Append(ref handler));
			}
			if (stringBuilder8.Length > 0)
			{
				stringBuilder8.Insert(0, "      <TC_MOPC>" + Environment.NewLine);
				stringBuilder11 = stringBuilder8;
				StringBuilder stringBuilder28 = stringBuilder11;
				handler = new StringBuilder.AppendInterpolatedStringHandler(16, 1, stringBuilder11);
				handler.AppendLiteral("      </TC_MOPC>");
				handler.AppendFormatted(Environment.NewLine);
				stringBuilder.Append(stringBuilder28.Append(ref handler));
			}
			if (stringBuilder9.Length > 0)
			{
				stringBuilder9.Insert(0, "      <TC_MOPC>" + Environment.NewLine);
				stringBuilder11 = stringBuilder9;
				StringBuilder stringBuilder29 = stringBuilder11;
				handler = new StringBuilder.AppendInterpolatedStringHandler(16, 1, stringBuilder11);
				handler.AppendLiteral("      </TC_MOPC>");
				handler.AppendFormatted(Environment.NewLine);
				stringBuilder.Append(stringBuilder29.Append(ref handler));
			}
			if (stringBuilder10.Length > 0)
			{
				stringBuilder11 = stringBuilder;
				StringBuilder stringBuilder30 = stringBuilder11;
				handler = new StringBuilder.AppendInterpolatedStringHandler(17, 1, stringBuilder11);
				handler.AppendLiteral("      </DataElem>");
				handler.AppendFormatted(Environment.NewLine);
				stringBuilder30.Append(ref handler);
				stringBuilder10.Insert(0, "      <TDI>" + Environment.NewLine);
				stringBuilder11 = stringBuilder10;
				StringBuilder stringBuilder31 = stringBuilder11;
				handler = new StringBuilder.AppendInterpolatedStringHandler(12, 1, stringBuilder11);
				handler.AppendLiteral("      </TDI>");
				handler.AppendFormatted(Environment.NewLine);
				stringBuilder.Append(stringBuilder31.Append(ref handler));
			}
			stringBuilder.Append("    </DataElem>\r\n  </ToolList>\r\n</Action>\r\n");
			string text = stringBuilder.ToString();
			return stringBuilder.ToString();
		}

		public static string CreateMasterData(string toolIdentify, int toolType, UserDataEntity entity)
		{
			string value = ((entity != null) ? BodyBuild.CreateUserData(entity) : "");
			DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(422, 3);
			defaultInterpolatedStringHandler.AppendLiteral("  <Action ID = \"123\">\r\n                <ToolData>\r\n                <DataElem>\r\n                <TC_TP>\r\n                <TC_TP2>");
			defaultInterpolatedStringHandler.AppendFormatted(toolIdentify);
			defaultInterpolatedStringHandler.AppendLiteral("</TC_TP2>\r\n                </TC_TP>\r\n                ");
			defaultInterpolatedStringHandler.AppendFormatted(value);
			defaultInterpolatedStringHandler.AppendLiteral("\r\n                <DataElem Index = \"1\" >\r\n                <TC_DP>\r\n                <TC_DP1>");
			defaultInterpolatedStringHandler.AppendFormatted(toolType);
			defaultInterpolatedStringHandler.AppendLiteral("</TC_DP1>\r\n                </TC_DP>\r\n                </DataElem>\r\n                </DataElem>\r\n                </ToolData>\r\n                </Action>");
			return defaultInterpolatedStringHandler.ToStringAndClear();
		}

		public static string CreateUserData(string userDataName, UserDataEntity entity)
		{
			DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(117, 2);
			defaultInterpolatedStringHandler.AppendLiteral("<ToolList dataFormat=\"");
			defaultInterpolatedStringHandler.AppendFormatted(userDataName);
			defaultInterpolatedStringHandler.AppendLiteral("\">\r\n\t<DataElem>\r\n\t\t<DataElem Index=\"1\"></DataElem>\r\n                ");
			defaultInterpolatedStringHandler.AppendFormatted(BodyBuild.CreateUserData(entity));
			defaultInterpolatedStringHandler.AppendLiteral("\r\n\t</DataElem>\r\n</ToolList>");
			return defaultInterpolatedStringHandler.ToStringAndClear();
		}

		public static string CreateUserData(UserDataEntity entity)
		{
			if (entity == null)
			{
				throw new ArgumentNullException();
			}
			StringBuilder stringBuilder = new StringBuilder("<TC_TPC>" + Environment.NewLine);
			PropertyInfo[] properties = entity.GetType().GetProperties();
			PropertyInfo[] array = properties;
			foreach (PropertyInfo propertyInfo in array)
			{
				MmtDataElemAttribute mmtDataElemAttribute = Attribute.GetCustomAttribute(propertyInfo, typeof(MmtDataElemAttribute)) as MmtDataElemAttribute;
				if (mmtDataElemAttribute != null && !mmtDataElemAttribute.Ignore)
				{
					StringBuilder stringBuilder2 = stringBuilder;
					StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(21, 4, stringBuilder2);
					handler.AppendLiteral("                <");
					handler.AppendFormatted(mmtDataElemAttribute.Adr);
					handler.AppendLiteral(">");
					handler.AppendFormatted<object>(propertyInfo.GetValue(entity));
					handler.AppendLiteral("</");
					handler.AppendFormatted(mmtDataElemAttribute.Adr);
					handler.AppendLiteral(">");
					handler.AppendFormatted(Environment.NewLine);
					stringBuilder2.Append(ref handler);
				}
			}
			stringBuilder.Append("                </TC_TPC>");
			return stringBuilder.ToString();
		}

		public static string UserDataFormat(UserDataEntity entity)
		{
			StringBuilder stringBuilder = new StringBuilder("\"TC_TPC\":{");
			PropertyInfo[] properties = entity.GetType().GetProperties();
			PropertyInfo[] array = properties;
			foreach (PropertyInfo propertyInfo in array)
			{
				MmtDataElemAttribute mmtDataElemAttribute = Attribute.GetCustomAttribute(propertyInfo, typeof(MmtDataElemAttribute)) as MmtDataElemAttribute;
				if (mmtDataElemAttribute != null && !mmtDataElemAttribute.Ignore)
				{
					StringBuilder stringBuilder2 = stringBuilder;
					StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(4, 2, stringBuilder2);
					handler.AppendLiteral("\"");
					handler.AppendFormatted(mmtDataElemAttribute.Adr);
					handler.AppendLiteral("\":");
					handler.AppendFormatted<object>(propertyInfo.GetValue(entity));
					handler.AppendLiteral(",");
					stringBuilder2.Append(ref handler);
				}
			}
			string text = stringBuilder.ToString();
			if (text.EndsWith(","))
			{
				text = text.Remove(text.Length - 1, 1) + "},";
			}
			return text;
		}

		public static string QueryMasterData()
		{
			return "<Action ID = \"120\">\r\n                <ToolData>\r\n                <DataElem>\r\n                <TC_TP>\r\n                <TC_TP2/>\r\n                <TC_DP1/>\r\n                <TOOL_COMMENT/>\r\n                </TC_TP>\r\n                </DataElem>\r\n                </ToolData>\r\n                </Action>";
		}

		public static string DeleteMasterData(string toolIdentify)
		{
			return "<Action ID = \"122\">\r\n                <ToolData>\r\n                <DataElem>\r\n                <TC_TP>\r\n                <TC_TP2>" + toolIdentify + "</TC_TP2>\r\n                </TC_TP>\r\n                </DataElem>\r\n                </ToolData>\r\n                </Action>";
		}
	}
}
